#include <iostream>
#include <algorithm>
#include <vector>
#include <memory.h>
using namespace std;

vector<int> G[10005]; 
int dfn[10005], low[10005];
int n, m;
int sum, root;
int iscut[10005];

void tarjan(int x) {
	int flag = 0;
	dfn[x] = low[x] = ++sum;
	for (unsigned i = 0; i < G[x].size(); ++i) {
		int y = G[x][i];
		if (!dfn[y]) {
			tarjan(y);
			low[x] = min(low[y], low[x]);
			if (low[y] >= dfn[x]) {
				++flag;
				if (x != root) ++iscut[x];
			}
		} else {
			low[x] = min(low[x], dfn[y]);
		}
	}
	if (x == root) iscut[x] = flag - 1;
}

int main() {
	while (1) {
		int x, y;
		cin >> n >> m;
		
		if (n == 0 && m == 0) break;
		
		for (int i = 1; i <= m; ++i) {
			cin >> x >> y;
			G[x+1].push_back(y + 1);
			G[y+1].push_back(x + 1);
		}
		
		int replus = 0;
		for (int i = 1; i <= n; ++i) {
			if (!dfn[i]) {
				++replus;
				root = i;
				tarjan(i);
			}
		}
		
		int maxx = 0;
		for (int i = 1; i <= n; ++i) {
			if (iscut[maxx] < iscut[i]) {
				maxx = i;
			}
		}
		
		cout << iscut[maxx] + replus << endl;
		
		for (int i = 0; i <= n; ++i) {
			G[i].clear();
		}
		memset(dfn, 0, sizeof(dfn));
		memset(low, 0, sizeof(low));
		memset(iscut, 0, sizeof(iscut));
		sum = 0;
	}
	return 0;
}
